# main.py
import tkinter as tk
from app import AccountingApp

def main():
    """主函数"""
    # 开发阶段 - 直接抛出异常以便调试
    root = tk.Tk()
    app = AccountingApp(root)
    root.mainloop()
    
    # 发布阶段可使用以下代码替换上面三行：
    """
    root = None
    try:
        root = tk.Tk()
        app = AccountingApp(root)
        root.mainloop()
    except KeyboardInterrupt:
        print("程序被用户中断")
    except Exception as e:
        import traceback
        error_msg = traceback.format_exc()
        print(f"程序发生未预期的错误: {e}")
        print(f"错误详情:\n{error_msg}")
    finally:
        if root:
            try:
                root.destroy()
            except:
                pass
        print("程序已退出")
    """

if __name__ == "__main__":
    main()